package com.im.server.enterprise.business.push;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.im.server.general.business.message.data.chat.Content;
import com.im.server.general.business.mq.MessageQueueWriteHandler;
import com.im.server.general.common.message.Head;
import com.im.server.general.common.message.PushMessage;

/**
 * @author: XiaHui
 * @date: 2016年8月26日 上午9:21:41
 */
@Service
public class DepartmentChatPush {
	@Resource
	MessageQueueWriteHandler messageQueueWriteHandler;

	public void pushDepartmentChat(String key, String departmentId, String userId, Content content, List<String> userIdList) {
		PushMessage message = new PushMessage();
		message.put("departmentId", departmentId);
		message.put("userId", userId);
		message.put("content", content);

		Head head = new Head();
		head.setAction("1.500");
		head.setMethod("1.2.5001");
		head.setKey(key);
		head.setTime(System.currentTimeMillis());
		message.setHead(head);
		messageQueueWriteHandler.push(userIdList, message);
	}
}
